package day09_Properties_topic9;

import java.io.FileReader;
import java.io.IOException;
import java.util.Properties;
import java.util.ResourceBundle;
/*使用ResourceBundle工具类，将brand，capacity，price的值读取并打印到控制台。*/

public class ResourceBundlePractic {
    public static void main(String[] args) {
        ResourceBundle bundle = ResourceBundle.getBundle("iphone");
        String brand = bundle.getString("brand");
        String capacity = bundle.getString("capacity");
        String price = bundle.getString("price");
        System.out.println("brand="+brand);
        System.out.println("capacity="+capacity);
        System.out.println("price="+price);

//        Properties properties = new Properties();
//        try {
//            properties.load(new FileReader(bundle));
//            for (String key : properties.stringPropertyNames()) {
//                System.out.println(key+"="+properties.getProperty(key));
//            }
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
    }
}
